package org.jason.interaction.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jason.interaction.service.InteractionService;
import org.jason.model.common.dtos.ResponseResult;
import org.jason.model.interaction.dtos.ArticleInteractionDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "互动模块", value = "InteractionController")
@RestController
@RequestMapping("/interaction")
public class InteractionController {

    @Autowired
    private InteractionService interactionService;

    /**
     * 文章互动
     * @param dto
     * @return
     */
    @ApiOperation("文章互动 1-点赞 2-收藏 3-评论")
    @PostMapping("/article")
    @SaCheckLogin
    public ResponseResult articleInteraction(@RequestBody @Validated ArticleInteractionDto dto){
        return interactionService.articleInteraction(dto);
    }
}
